import { HashRouter,BrowserRouter, Routes, Route } from "react-router-dom";
import {lazy,Suspense} from "react";

const Index  = lazy(() => import('../pages/index'));
const Login  = lazy(() => import('../pages/login/login'));
const Home  = lazy(() => import('../pages/home/home'));
const Category  = lazy(() => import('../pages/category/cateagory'));
const Enroll = lazy(()=>import('../pages/enroll/enroll'));
const BasicRoute = () => {

   return <HashRouter>
    {/* 路由懒加载是 异步延迟，优化 */}
     <Suspense fallback={''}>
      <Routes>
        {/* 重定向设置 默认子路由 */}

        <Route path='/'  element={ <Index />}>
            <Route path=""  element={  <Home/> }></Route>
            <Route path="home"   element={  <Home/> }></Route>
            <Route path="category/:id"   element={  <Category/> }></Route>
        </Route>
        <Route path='/login'  element={ <Login />}></Route>
        <Route path='/demo'  element={ <Enroll />}></Route>

        
       

  
      </Routes>
      </Suspense>
    </HashRouter>
}
export default BasicRoute;

// react-router    react-router-dom




